package cn.gson.springboot.model.pjos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

/**
 * 销售目标表
 */
@Entity
@Table(name = "target", schema = "springboot", catalog = "")
public class Target {
    private int goalId;                 //销售id
    private Timestamp goalDate;         //销售时间
    private Double goalValue;           //目标值
    private String goalRemark;          //备注
    private Emp empByEmployeesId;       //员工编号
    private Dept deptByDeptsId;         //部门编号

    @Id
    @Column(name = "goal_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getGoalId() {
        return goalId;
    }

    public void setGoalId(int goalId) {
        this.goalId = goalId;
    }

    @Basic
    @Column(name = "goal_date")
    public Timestamp getGoalDate() {
        return goalDate;
    }

    public void setGoalDate(Timestamp goalDate) {
        this.goalDate = goalDate;
    }

    @Basic
    @Column(name = "goal_value")
    public Double getGoalValue() {
        return goalValue;
    }

    public void setGoalValue(Double goalValue) {
        this.goalValue = goalValue;
    }

    @Basic
    @Column(name = "goal_remark")
    public String getGoalRemark() {
        return goalRemark;
    }

    public void setGoalRemark(String goalRemark) {
        this.goalRemark = goalRemark;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Target target = (Target) o;
        return goalId == target.goalId &&
                Objects.equals(goalDate, target.goalDate) &&
                Objects.equals(goalValue, target.goalValue) &&
                Objects.equals(goalRemark, target.goalRemark);
    }

    @Override
    public int hashCode() {
        return Objects.hash(goalId, goalDate, goalValue, goalRemark);
    }

    @ManyToOne
    @JoinColumn(name = "employees_id", referencedColumnName = "employees_id")
    public Emp getEmpByEmployeesId() {
        return empByEmployeesId;
    }

    public void setEmpByEmployeesId(Emp empByEmployeesId) {
        this.empByEmployeesId = empByEmployeesId;
    }

    @ManyToOne
    @JoinColumn(name = "depts_id", referencedColumnName = "depts_id")
    public Dept getDeptByDeptsId() {
        return deptByDeptsId;
    }
    public void setDeptByDeptsId(Dept deptByDeptsId) {
        this.deptByDeptsId = deptByDeptsId;
    }
}
